<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数式组件</title>
    <style>
        #header{
            height: 100px;
            background: #aef;
        }
        #section{
            height: 400px;
            background: rgb(224, 223, 153);
        }

        #footer{
            height: 100px;
            background: rgb(235, 133, 222);
        }
    </style>
</head>
<body>
    <div id="root"></div>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>

    <script type="text/babel">

        //声明一个函数  函数式组件 函数首字母一定要『大写』
        function Header(){
            //返回虚拟 DOM 
            return <div id="header">顶部内容</div>;
        }

        function Main(){
            return <div id="section">主体内容</div>;
        }

        function Footer(){
            return <div id="footer">尾部内容</div>;
        }

        //创建虚拟 DOM
        function App(){
            return <div>
                <Header></Header>
                <Main />
                <Footer />
            </div>
        }

        ReactDOM.render(<App />, document.querySelector("#root"));
    </script>
</body>
</html>